{include file="common/header"/}
<div class="LM-container">
    <div class="LM-main">
        <div class="admin-main layui-anim layui-anim-upbit">
            <fieldset class="layui-elem-field layui-field-title">
                <legend>{$title}</legend>
            </fieldset>
            <form class="layui-form layui-form-pane" lay-filter="form">
                <div class="layui-form-item">
                    <label class="layui-form-label">模型名字</label>
                    <div class="layui-input-inline">
                        <input type="text" name="title" lay-verify="required" placeholder="{:lang('pleaseEnter')}模型名字" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        在4到25个字符之间。
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">表名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" lay-verify="required" placeholder="{:lang('pleaseEnter')}表名" class="layui-input {if $info}layui-disabled{/if}" {if $info}disabled{/if} >
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        在4到25个字符之间。
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">表描述</label>
                    <div class="layui-input-block">
                        <textarea name="description" class="layui-textarea"></textarea>                    </div>

                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">列表页查询字段</label>
                    <div class="layui-input-inline">
                        <input type="text" name="listfields" value="*" placeholder="{:lang('pleaseEnter')}列表页调用字段" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        多字段用|分割
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">新建表字段</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="emptytable" {if $info}disabled{/if} value="0" title="空表字段" checked>
                        <input type="radio" name="emptytable" {if $info}disabled{/if} value="1"  title="普通文章表字段">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="status" lay-filter="status" checked="" value="1" title="开启">
                        <input type="radio" name="status" lay-filter="status" value="0" title="关闭">
                    </div>
                </div>
<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">是否单页</label>-->
<!--                    <div class="layui-input-inline">-->
<!--                        <input type="radio" name="ispage" lay-filter="page" checked="" value="0" title="否">-->
<!--                        <input type="radio" name="ispage" lay-filter="page" value="1" title="是">-->
<!--                    </div>-->
<!--                </div>-->

                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-inline">
                        <input type="text" name="sort" lay-filter="sort" value="50"  class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item web_list">
                    <label class="layui-form-label">列表模板</label>
                    <div class="layui-input-inline ">
                        <select name="template[]">
                            <option value="list.html" selected>默认栏目列表页:list.html</option>
                            {volist name="_list" id="vo"}
                            <option value="{$vo}">{$vo}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item web_list">
                    <label class="layui-form-label">内容模板</label>
                    <div class="layui-input-inline ">
                        <select name="template[]">
                            <option value="show.html" selected>默认内容页:show.html</option>
                            {volist name="_show" id="vo"}
                            <option value="{$vo}">{$vo}</option>
                            {/volist}
                        </select>
                    </div>
                </div>



                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <input type="hidden" name="id" >
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
                        <a href="{:url('index')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{include file="common/footer"/}
<script>
        layui.use(['form'], function () {
            var form = layui.form,$= layui.jquery;
            var info = '';
            info = {:json_encode($info)};
            form.val("form", info);

            form.on('submit(submit)', function (data) {
                loading =layer.load(1, {shade: [0.1,'#fff']});
                // 提交到方法 默认为本身
                $.post("", data.field, function (res) {
                    layer.close(loading);
                    if (res.code > 0) {
                        layer.msg(res.msg, {time: 1000, icon: 1}, function () {
                            layer.closeAll("iframe");
                            //刷新父页面
                           location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {time: 1000, icon: 2});
                    }
                });
            })
        });
</script>